﻿@model PhotoGallery.Models.ViewModels.VideoViewModel
@using PhotoGallery.Views
@{
    ViewBag.Title = "Index";
}
@using PagedList.Mvc; @*//import this so we get our HTML Helper*@
@using PagedList; @*//import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@

@section javascript{
<!-- import the included stylesheet for some (very basic) default styling -->
    <link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />
}

<h2>@Labels.album @Model.Album.Title</h2>
<p>
    @Html.ActionLink(Labels.add, "Create")
</p>
<!-- loop through each of your products and display it however you want. we're just printing the name here -->
<ul class="thumbnails">
    @if (Model.Videos.Count() > 0)
    {
        foreach (var video in ViewBag.OnePageOfProducts)
        {
            <li class="item">
                <div>                       
                    <a href="@Url.Action("Show","Video",new { id = video.ID })">
                        @if (String.IsNullOrEmpty(video.FileName))
                        {
                            <img alt="" src="@Url.Content("~//Content//no_video.png")" class="thumbnail-border" width="180" height="180" />
                        }
                        else
                        {
                            @*<img alt="@video.Title" src="@Url.Action("Thumbnail", new { file = video.FullThumbnailName})"/>*@
                            <img alt="@video.Title"  src="@Url.Content(video.UrlThumbnail)" />
                        }
                    </a>
                    <p>@video.Title</p>
                    <span class="image-overlay">
                        @Html.ActionLink(Labels.info, "Details",  new { id = video.ID })
                        @Html.ActionLink(Labels.edit,"Edit", new { id = video.ID})
                        @Html.ActionLink(Labels.delete, "Delete", new { id = video.ID })
                    </span>
                </div>
            </li>
        }
    }
    else
    {
        <li class="item">
            <div>                       
                <a href="@Url.Action("Create")">
                    <img alt="" src="@Url.Content("~//Content//no_video.jpg")" class="thumbnail-border" width="180" />
                </a>
                <p></p>
            </div>
        </li>
    }
</ul>

<!-- output a paging control that lets the user navigation to the previous page, next page, etc -->
<div style="clear:both">
    @Html.PagedListPager( (IPagedList)ViewBag.OnePageOfProducts, page => Url.Action("List", new { page }) )
</div>
